<?php

namespace App\Validator\Admin\Content;

use App\Validator\BaseValidator;

class AdGroupValidator extends BaseValidator
{

    protected array $attr = [
        'id' => '广告图组id',
        'ids' => '广告图组id',
        's_code' => '唯一标识',
        'code' => '唯一标识',
        's_name' => '组名称',
        'name' => '组名称',
    ];

    public function pageList($data)
    {
        return $this->validatePage($data,[
            's_code' => ['nullable','string',],
            's_name' => ['nullable','string',],
        ]);
    }

    public function add($data)
    {
        return $this->validate($data,[
            'code' => ['required','alpha_dash',],
            'name' => ['required','string',],
            'remark' => ['nullable','string',],
        ]);
    }

    public function detail($data)
    {
        return $this->validate($data,[
            'id' => ['required','integer','min:1'],
        ]);
    }

    public function update($data)
    {
        return $this->validate($data,[
            'id' => ['required','integer','min:1'],
            'code' => ['required','alpha_dash',],
            'name' => ['required','string',],
            'remark' => ['nullable','string',],
        ]);
    }

    public function del($data)
    {
        return $this->validate($data,[
            'ids' => ['required','array','min:1'],
            'ids.*' => ['required','integer','min:1'],
        ]);
    }


}
